package com.ruoyi.web.controller.info;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.info.domain.SysClass;
import com.ruoyi.info.service.ISysSigninService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 首页Controller
 *
 * @author silencezheng
 * @date 2022-10-20
 */
@RestController
@RequestMapping("/index")
public class IndexController extends BaseController
{
    @Autowired
    private ISysSigninService signinService;

    /**
     * 获取设备统计
     *
     * @return
     */
    @GetMapping("/getCount")
    public AjaxResult getCount() {
        return AjaxResult.success(signinService.getCount());
    }
    /**
     * 获取近七天签到统计
     */
    @GetMapping("/getSevenDayCount")
    public AjaxResult getSevenDayCount() {
        List<Map<String, Object>> countList = signinService.getSevenDayCount();
        return AjaxResult.success(countList);
    }
}
